<?php
    require_once 'include_dao.php';
    ini_set("display_errors", $DISPLAY_ERROR);
    require("PHPMailer/class.phpmailer.php"); //Importamos la función PHP class.phpmailer

if($_POST)
{
    if ($_POST['action'] == "send")
    {
       
        $mail = new PHPMailer();

        $mail->Host = "localhost";
        $mail->From = DAOFactory::getTipoSeccionDAO()->load($CORREO_FROM)->uRLUsuraio;
        $mail->FromName = "The Pub";
        $mail->Subject ='Correo Automatico ThePub';
   
        if (isset ($_POST['chkreserva']) ){
         $mail->AddAddress(DAOFactory::getTipoSeccionDAO()->load($CORREO_RESERVAS)->uRLUsuraio);
        }
        if (isset ($_POST['chkservicio']) ){
         $mail->AddAddress(DAOFactory::getTipoSeccionDAO()->load($CORREO_SERVICIO)->uRLUsuraio);
        }
        if (isset ($_POST['chkthepub']) ){
         $mail->AddAddress(DAOFactory::getTipoSeccionDAO()->load($CORREO_CLUB)->uRLUsuraio); 
        }

        $body = "<strong>Mensaje Automatico The Pub</strong><br><br>";
        $body.= "Nombre: "   .$_POST['txtnombre']."<br>";
        $body.= "Email: "    .$_POST['txtemail']."<br>";
        $body.= "Telefono: " .$_POST['txttelefono']."<br>";
        $body.= "Ciudad: "   .$_POST['txtciudad']."<br>";
        $body.= "Dirección: ".$_POST['txtdireccion']."<br>";
        $body.= "Mensaje: "  .$_POST['txtarea']."<br><br>";
        $body.= "<i>Enviado por The Pub (c)</i>";

        $mail->Body = $body;
        $mail->IsHTML(true);
        $mail->Send();
    }
}
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title></title>
        <link rel="stylesheet" type="text/css" href="./resources/css/frontend.css" media="screen" />
        <style type="text/css">

            input.txt{
                background: url(resources/img/Campo-largo-de-Contactenos.gif) no-repeat;
                width: 256px;
                height: 30px;
                padding: 10px;
                border: none;
            }

            textarea{ 
                background:url(resources/img/Fondo-cuadro-de-mensaje.gif) no-repeat;
                width: 405px;
                height: 405px;
                padding: 12px;
                border: none;
            }
            .imgtextos
            {
                //background: url(resources/img/Campo-largo-de-Contactenos.gif) no-repeat;
                width: 256px;
                height: 41px;
                border: none;
            }
            body{background-color: #fff;
                 color:#41752B;

            }
   
             input [type="checkbox"] .chk {
                background: url(resources/img/Campo-de-chek-box-contactenos.gif) no-repeat;
                color:#000;
                font-size:16px;
             }
             
             label {
                padding-left: 20px;
                height: 16px;
             }
                
            input[type="checkbox"] + label{
                background: url(resources/img/Campo-de-chek-box-contactenos.gif)  0 0 no-repeat;
            }
            .boton {background: url(resources/img/<?php echo Idioma("Enviar.gif","Send.gif");?>) no-repeat;
                     width: 90px;
                     height: 50px;
					 border-color:transparent
              }
            input.file {background: url(resources/img/txtfile.gif) no-repeat;}
            
            td{ padding: 5px;}
            .botonpadin{ text-align:right} 
             .titulotexto
            {
                text-align: center;
                color: #407928;
                border-bottom: 1px solid #407928;
                border-top: 1px solid #407928;
                font-weight: bold;
                font-size: 24px;
                padding: 3px;
            }
            
        </style>
    </head>
    <body>
        <form action="" method="post" enctype="multipart/form-data">

        <table width="100%" >
            <tr>
                <td colspan="5" style="text-align: center;">
                   <img src="resources/img/The-pub-solo-sin-titulo.gif" alt="" width="200"/>
                    <div style="text-align: center; padding: 3px">
                        <span class="titulotexto">
                    <?php
                   if($_SESSION['_IDIOMA']==$IDIOMA_ESP)
                            echo "Contáctenos";
                        else
                            echo "Contact Us";
                    ?>
                        </span>
                    </div>
                </td>
            </tr>
            <tr>
                <td width="100px" ><?php echo Idioma("Nombre","Name");?></td>
                <td width="260px" class="imgtextos">
                    <input type="text" class="txt" name="txtnombre" />
                </td>
                <td  rowspan="10" width="100px">&nbsp;</td>
                <td colspan="2"  rowspan="10">
                    <textarea id="txtarea" name="txtarea" rows="22" cols="40"  onblur="if(this.value=='') this.value='Escribanos su mensaje...';" onfocus="if(this.value=='Escribanos su mensaje...') this.value='';">Escribanos su mensaje...</textarea>

                </td>

            </tr>
            <tr>
                <td><?php echo Idioma("Correo","Email");?></td>
                <td class="imgtextos"><input type="text" class="txt" name="txtemail" /></td>
            </tr>
            <tr>
                <td><?php echo Idioma("Tel&eacute;fono","Phone");?></td>
                <td class="imgtextos"><input type="text" class="txt" name="txttelefono" /></td>
            </tr>
            <tr>
                <td><?php echo Idioma("Ciudad","City");?></td>
                <td class="imgtextos"><input type="text" class="txt" name="txtciudad" /></td>
            </tr>
            <tr>
                <td><?php echo Idioma("Direcci&oacute;n","Address");?></td>
                <td class="imgtextos"><input type="text" class="txt" name="txtdireccion" /></td>
            </tr>
            <tr>
                <td><?php echo Idioma("Reservas","Reserves");?></td>
                <td><input type="checkbox" id="chkreserva" class="chk" name="chkreserva" /></td>
            </tr>
            <tr>
                <td><?php echo Idioma("Servicio al Cliente","Client Services");?></td>
                <td><input type="checkbox" id="chkservicio" name="chkservicio" /></td>
            </tr>
            <tr>
                <td><?php echo Idioma("The Pub Club","The Pub Club");?></td>
                <td><input type="checkbox" id="chkthepub" name="chkthepub" /></td>
            </tr>
            <tr>
                <td colspan="2" >&nbsp;</td>
            </tr>
            <tr>
                <td colspan="2">&nbsp;</td>
            </tr>
            <tr>
                <td colspan="5" class="botonpadin">
                    <input type="submit" class="boton" value="" title="" />
                    <input type="hidden" name="action" value="send" />
                </td>
            </tr>
        </table>
        </form>
    </body>
</html>
